@extends('layouts.app')

@section('content')
	{{--<div data-options="region:'center'"  class="easy_center">
		<div id="tt" class="easyui-tabs" style="width:100%;" data-options="border:false,fit:true,plain:true">
			<div title="首页"></div>
		</div>
	</div>--}}
	<div class="main-content">
		@if(auth::user()->role_id != 22)
		<div class="search_inp">
			<table width="100%" border="1" class="table_search">
				<thead>
					<tr>
						<th colspan="6">
							<span>查询条件</span>
						</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td width="13.33%" align="right"><label>重点级别：</label></td>
						<td width="20%">
							<select name="jibie" class="w150">
								<option value="">请选择重点级别</option>
								<option value="10">省级重点单位</option>
								<option value="20">市级重点单位</option>
								<option value="30">县区级重点单位</option>
								<option value="40">一般单位</option>
							</select>
						</td>
						<td width="13.33%" align="right"><label>企业类型：</label></td>
						<td width="20%">
							<select name="type" class="w150">
								<option value="">请选择企业类型</option>
								@foreach($type as $v)
									<option value="{{$v->id}}">{{$v->name}}</option>
								@endforeach
							</select>
						</td>
						<td width="13.33%" align="right"><label>企业性质：</label></td>
						<td width="20%">
							<select name="xingzhi" class="w150">
								<option value="">请选择企业性质</option>
								<option value="10">国有</option>
								<option value="20">民营</option>
								<option value="30">股份</option>
								<option value="40">合资</option>
								<option value="50">外资</option>
								<option value="60">个体</option>
								{{--@foreach($type as $v)

									<option value="{{$v->id}}">{{$v->name}}</option>
								@endforeach--}}
							</select>
						</td>
					</tr>
					<tr>
						<td width="13.33%" align="right"><label>企业状态：</label></td>
						<td width="20%">
							<select name="is_del" class="w150">
								<option value="">请选择企业状态</option>
								<option value="0">实有</option>
								<option value="1">注销</option>
								<option value="2">合并</option>
							</select>
						</td>
						<td width="13.33%" align="right"><label>单位名称：</label></td>
						<td width="20%"><input type="text" class="" name="name" placeholder="请输入单位关键字"/></td>
						<td width="13.33%" align="right"></td>
						<td width="20%">
							<input type="hidden" name="map_id" value=""/>
							<input type="hidden" name="city" value=""/>
							<input type="hidden" name="area" value=""/>
							<input type="hidden" name="org_id" value=""/>
							<a href="javascript:" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width:80px;margin-left: 70px" onclick="doSearch()">查询</a>
						</td>
					</tr>
					<tr>
						<td></td>
						<td colspan="5" width="20%">
							<a href="javascript:" class="easyui-linkbutton" data-options="iconCls:'icon-large-chart'" style="width:90px" id="tjt">按地区统计</a>
							<a href="javascript:" class="easyui-linkbutton" data-options="iconCls:'icon-large-chart'" style="width:90px" id="tjt2">按级别统计</a>
							<a href="javascript:" class="easyui-linkbutton" data-options="iconCls:'icon-large-chart'" style="width:90px" id="tjt3">按类别统计</a>
							<a href="javascript:" class="easyui-linkbutton" data-options="iconCls:'icon-large-chart'" style="width:90px" id="tjt4">按状态统计</a>
							<a href="javascript:" class="easyui-linkbutton" data-options="iconCls:'icon-large-chart'" style="width:90px" id="tjt5">按性质统计</a>
						</td>
					</tr>
				</tbody>
			</table>
		</div>

		@else
            @if(auth::user()->unit_id != '')
            <div id="taby" class="easyui-tabs" border="false" style="width:100%;height:738px;overflow: hidden;position:relative;">
                <a href="javascript:history.back(-1);" class="easyui-linkbutton forback" plain="true" iconCls="icon-back">返回</a>

                @if($status == 5)
                    <a href="{{url('admin/units/update',auth::user()->unit_id)}}" class="easyui-linkbutton forupdate update" plain="true" iconCls="icon-reload">更新</a>
                @elseif($status == 10)
                    <a href="javascript:" class="easyui-linkbutton forupdate" plain="true">等待审核中</a>
                @elseif($status == 20)
                    <a href="javascript:" class="easyui-linkbutton forupdate" plain="true">审核通过</a>
                @endif
                <div title="基本情况" style="overflow:hidden">
                    <iframe scrolling="auto" frameborder="0"  src="{{url('admin/units/edit',auth::user()->unit_id)}}" style="width:100%;height:100%;"></iframe>
                </div>
                <div title="法人登记" style="overflow:hidden">
                    <iframe scrolling="auto" frameborder="0"  src="{{url('admin/units/faren',auth::user()->unit_id)}}" style="width:100%;height:100%;"></iframe>
                </div>
                <div title="保卫人员登记" style="overflow:hidden">
                    <iframe scrolling="auto" frameborder="0"  src="{{url('admin/units/baowei',auth::user()->unit_id)}}" style="width:100%;height:100%;"></iframe>
                </div>
                <div title="重点岗位人员登记" style="overflow:hidden">
                    <iframe scrolling="auto" frameborder="0"  src="{{url('admin/units/zdry',auth::user()->unit_id)}}" style="width:100%;height:100%;"></iframe>
                </div>
                <div title="重要部位登记" style="overflow:hidden">
                    <iframe scrolling="auto" frameborder="0"  src="{{url('admin/units/zybw',auth::user()->unit_id)}}" style="width:100%;height:100%;"></iframe>
                </div>
            </div>
        </div>
        <script>
		    $(document).ready(function(){
		    	var winHeight =  window.screen.height;
				var winWidth = 	window.screen.width;
				if(winWidth == 1024){
			  	 	$('#taby').css('height',703+'px');
			  	 	$('#taby').find('iframe').css('height',674+'px');
				   }else if(winWidth == 1280){
			  	 	$('#taby').css('height',703+'px');
			  	 	$('#taby').find('iframe').css('height',674+'px');
				   }else if(winWidth == 1366){
				   	$('#taby').css('height',703+'px');
			  	 	$('#taby').find('iframe').css('height',674+'px');
				   }else if(winWidth == 1920){
			   		$('#taby').css('height',703+'px');
			  	 	$('#taby').find('iframe').css('height',674+'px');
				   }else{
			   		$('#taby').css('height',703+'px');
			  	 	$('#taby').find('iframe').css('height',674+'px');
				   }
		    })
        </script>
    		@else
        <form name="add_form" id="add_form" action="{{url('admin/units/add')}}" method="post" enctype="multipart/form-data" style="overflow-y: scroll;height:100%;">
            <input type="hidden" name="_token" value="{{ csrf_token() }}">
            <div id="div_print">
                <h2 class="text-center mg_b36 mg_t25" style="font-weight: bold;">企事业单位基本情况登记表</h2>
                <table class="table-form table-border w mg-auto">
                    <tbody>
                    <tr>
                        <td class="font-bd" align="center" width="16%">单位名称</td>
                        <td colspan="2"><input type="text" class="form-input w" value="{{auth::user()->unit_name}}" name="name"></td>
                        <td rowspan="3" class="text-center">
                            <div class="box_bt">
                                <span class="img_add"><img src="../../css/icons/edit_add.png">添加单位图片</span>
                                <input class="box_file" type="file" name="pic">
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="font-bd" align="center">详细地址</td>
                        <td colspan="2"><input type="text" class="form-input w"  value="" name="address"></td>
                    </tr>
                    <tr>
                        <td class="font-bd" align="center">辖区派出所</td>
                        <td colspan="2">
                            <div class="col-sm-3" style="margin-left: -15px;">
                                <input type="hidden" class="form-input" value="{{auth::user()->city}}" name="city">
                                <input type="text" class="form-input" value="{{getValue(auth::user()->city,'area','id','name')}}" disabled>
                            </div>
                            <div class="col-sm-3" style="margin-left:15px;">
                                <input type="hidden" class="form-input" value="{{auth::user()->area}}" name="area">
                                <input type="text" class="form-input" value="{{getValue(auth::user()->area,'area','id','name')}}" disabled>
                            </div>
                            <div class="col-sm-3" style="margin-left:15px;">
                                <input type="hidden" class="form-input" value="{{auth::user()->org_id}}" name="org_id">
                                <input type="text" class="form-input" value="{{getValue(auth::user()->org_id,'area','id','name')}}" disabled>
                            </div>
                        </td>
                    </tr>
                    <tr><td colspan="4" style="background-color: #69CEE9;text-align: center">单位信息</td></tr>
                    <tr>
                        <td class="font-bd" align="center" width="16%">统一社会信用码</td>
                        <td width="34%">
                            <input type="text" class="form-input" value="" name="zuzhijigou">（18位）
                        </td>
                        <td class="font-bd" align="center" width="16%">所属行业类别</td>
                        <td width="34%">
                            <input type="hidden" class="form-input" value="{{auth::user()->unit_type}}" name="type">
                            <input type="text" class="form-input" value="{{getValue(auth::user()->unit_type,'unit_type','id','name')}}" disabled>
                        </td>
                    </tr>
                    <tr>
                        <td class="font-bd" align="center">重点级别</td>
                        <td>
                            <select class="w153 input_all" name="is_imp">
                                <option value="">请选择重点级别</option>
                                <option value="10">省级重点单位</option>
                                <option value="20">市级重点单位</option>
                                <option value="30">县区级重点单位</option>
                                <option value="40">一般单位</option>
                            </select>
                        </td>
                        <td class="font-bd" align="center">单位性质</td>
                        <td>
                            <select id="area" name="xingzhi" class="w150 input_all" style="width: 120px;">
                                <option value="">请选择单位性质</option>
                                <option value="10">国有</option>
                                <option value="20">民营</option>
                                <option value="30">股份</option>
                                <option value="40">合资</option>
                                <option value="50">外资</option>
                                <option value="60">个体</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="font-bd" align="center">上级部门</td>
                        <td>
                            <input type="text" class="form-input" name="shangjibumen" value="">
                        </td>
                        <td class="font-bd" align="center">单位状态</td>
                        <td>
                            <select class="w153 input_all" name="is_del">
                                <option value="0">实有</option>
                                <option value="1">注销</option>
                                <option value="2">合并</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="font-bd" align="center">固定资产（万元）</td>
                        <td>
                            <input type="text" class="form-input" value="" name="gdzc">
                        </td>
                        <td class="font-bd" align="center">要害部门部位数量</td>
                        <td>
                            <input type="text" class="form-input" value="" disabled>
                        </td>
                    </tr>
                    <tr><td colspan="4" style="background-color: #69CEE9;text-align: center">人员信息</td></tr>
                    <tr>
                        <td class="font-bd" align="center">在职职工总数</td>
                        <td>
                            <input type="text" class="form-input" value="" name="zaizhi_num_of_peo">
                        </td>
                        <td class="font-bd" align="center">在职保安人数</td>
                        <td>
                            <input type="text" class="form-input" value="" disabled>
                        </td>
                    </tr>
                    <tr>
                        <td class="font-bd" align="center">自招保安人数</td>
                        <td>
                            <input type="text" class="form-input" value="" disabled>
                        </td>
                        <td class="font-bd" align="center">外聘保安人数</td>
                        <td>
                            <input type="text" class="form-input" value="" disabled>
                        </td>
                    </tr>
                    <tr>
                        <td class="font-bd" align="center">重点岗位人数</td>
                        <td>
                            <input type="text" class="form-input" value="" disabled>
                        </td>
                        <td class="font-bd" align="center">维稳对象人数</td>
                        <td>
                            <input type="text" class="form-input" value="" name="zdwwgzdx_num_of_peo">
                        </td>
                    </tr>
                    <tr>
                        <td class="font-bd" align="center">单位法人</td>
                        <td>
                            <input type="text" class="form-input" value="" name="frdb_name">
                        </td>
                        <td class="font-bd" align="center">联系电话</td>
                        <td>
                            <input type="text" class="form-input" value="" name="frdb_phone">
                        </td>
                    </tr>
                    <tr>
                        <td class="font-bd" align="center">保卫负责人</td>
                        <td>
                            <input type="text" class="form-input" value="" name="bwfzr_name">
                        </td>
                        <td class="font-bd" align="center">联系电话</td>
                        <td>
                            <input type="text" class="form-input" value="" name="bwfzr_phone">
                        </td>
                    </tr>
                    <tr>
                        <td class="font-bd" align="center">责任民警</td>
                        <td>
                            <select class="w153 input_all easyui-validatebox" name="minjing" data-options="required:true,missingMessage:'责任民警不能为空',validateOnCreate:false,validateOnBlur:true">
                                <option value="">请选择</option>
                                @foreach($police as $k=>$v)
                                    <option value="{{$v->id}}">{{$v->name}}</option>
                                @endforeach
                            </select>
                        </td>
                        <td class="font-bd" align="center">联系电话</td>
                        <td>
                            <input type="text" class="form-input easyui-validatebox" value="" name="minjing_phone" data-options="required:true,validType:'phoneAndMobile',missingMessage:'联系电话不能为空',invalidMessage:'请输入正确的联系电话',validateOnCreate:false,validateOnBlur:true">
                        </td>
                    </tr>
                    <tr><td colspan="4" style="background-color: #69CEE9;text-align: center">GIS信息</td></tr>
                    <tr>
                        <td class="font-bd" align="center">经度</td>
                        <td>
                            <input type="text" class="form-input" name="jd" value="">
                        </td>
                        <td class="font-bd" align="center">纬度</td>
                        <td>
                            <input type="text" class="form-input" name="wd" value="">
                        </td>
                    </tr>
                    <tr><td colspan="4" style="background-color: #69CEE9;text-align: center">行业信息</td></tr>
                    @foreach($field as $vv)
                        <tr>
                            @foreach($vv as $v)
                                <td class="font-bd" align="center">{{$v->field_content}}</td>
                                <td>
                                    @if($v->field_type == 1)
                                        <input type="text" class="form-input" value="" name="field[{{$v->field_name}}]">
                                    @elseif($v->field_type == 2)
                                        <select class="w153 input_all" name="field[{{$v->field_name}}]">
                                            <option value="">请选择</option>
                                            @foreach($v->daan as $v2)
                                                <option value="{{$v2->val}}">{{$v2->val}}</option>
                                            @endforeach
                                        </select>
                                    @endif
                                </td>
                            @endforeach
                        </tr>
                    @endforeach
                    <tr>
                        <td class="font-bd" align="center">备注</td>
                        <td colspan="5">
                            <textarea class="textarea" name="remark"></textarea>
                        </td>
                    </tr>
                    </tbody>
                </table>

                {{--<div class="wbt mg_t25 mg_b18">
                    <span class="font-bd" style="margin-left: 10px;">填报单位：</span>
                    <input type="text" class="w250 input_bottom dsp" name="tbdw">
                    <span class="itv"></span>
                    <span class="font-bd">填报人：</span>
                    <input type="text" class="w250 input_bottom dsp" name="tbr">
                </div>--}}

                <div class="wbt mg_t25 pd_b20 text-center">
                    <button id="go" type="button" class="easyui-linkbutton dsp"  data-options="iconCls:'icon-save'">确定</button>
                    <a id="goToPageB" class="easyui-linkbutton dsp print" data-options="iconCls:'icon-print'" onclick="getjwd()">点击获取经纬度</a>


                    @if(auth::user()->unit_id != '')
                    <button type="button" class="easyui-linkbutton dsp" data-options="iconCls:'icon-no'" onclick="$('#w').window('close')">关闭</button>
                    @endif
                </div>
            </div>
        </form>

         <div id="jwd" class="easyui-window" closed="true" title="新增" data-options="iconCls:'icon-save'" style="width:700px;height:500px;padding:10px;">




        <script type="text/javascript">


            $(document).on("change",'#city', function(){
                $('#area option:gt(0)').remove();
                $('#org_id option:gt(0)').remove();
                //alert(1);die;
                var cid = $("#city").val();
                var url = "{{url('admin/getArea')}}";
                $.getJSON(url,{cid:cid},function(json){
                    /*清空原有的选项*/
                    if(json != ''){
                        $.each(json,function(index,array){
                            var option = "<option value='"+array['id']+"'";
                            option += ">"+array['name']+"</option>";
                            $("#area").append(option);
                        });
                    }
                });
            });

            $(document).on("change",'#area', function(){
                $('#org_id option:gt(0)').remove();
                var cid = $("#area").val();
                var url = "{{url('admin/getArea')}}";
                $.getJSON(url,{cid:cid},function(json){
                    /*清空原有的选项*/
                    if(json != ''){
                        $.each(json,function(index,array){
                            var option = "<option value='"+array['id']+"'";
                            option += ">"+array['name']+"</option>";
                            $("#org_id").append(option);
                        });
                    }
                });
            });
        </script>


        @if(auth::user()->unit_id != '')
        <script>
            $('#go').click(function (){
                var formData = new FormData($( "#add_form" )[0]);
                $.ajax({
                    type: "POST",
                    url: "{{url('admin/units/add')}}",
                    data: formData,
                    async: false,
                    cache: false,
                    contentType: false,
                    processData: false,

                    success: function(data) {
                        if(data.status == 1){
                            $.messager.alert('信息提示',data.msg,'info');
                            $('#w').dialog('close');
                            $('.pagination-load').click();
                        }else {
                            $.messager.alert('信息提示',data.msg,'info');
                        }
                    },
                    error: function(msg) {
                        var json=JSON.parse(msg.responseText);
                        $.each(json, function(index, value) {
                            $.messager.alert('信息提示',value,'info');die;
                        });
                    },
                });
            });
        </script>

        @else
        
          <script>
            $('#go').click(function (){
                var formData = new FormData($( "#add_form" )[0]);
                $.ajax({
                    type: "POST",
                    url: "{{url('admin/units/add')}}",
                    data: formData,
                    async: false,
                    cache: false,
                    contentType: false,
                    processData: false,

                    success: function(data) {
                        if(data.status == 1){
                            window.location.href="http://nb.yntosite.com/admin/index";
                        }else {
                            $.messager.alert('信息提示',data.msg,'info');
                        }
                    },
                    error: function(msg) {
                        var json=JSON.parse(msg.responseText);
                        $.each(json, function(index, value) {
                            $.messager.alert('信息提示',value,'info');die;
                        });
                    },
                });
            });
        </script>

        @endif




        <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=hrVnXxLAGVr6QZ0rt9MaxU8bBkwKzyQC"></script>
    <script type="text/javascript">
        function getjwd(){
            $('#jwd').window({
                title: "获取经纬度",
                href: '/admin/units/getjwd',
                width:'700',
                height:'500',
                minimizable:false,
                top:($(window).height() - 500) * 0.5,
                left:($(window).width() - 700) * 0.5,
                modal:true,
                closed: false,
            });
        }
    </script>
			


		  </div>

		   <script>
		    $(document).ready(function(){
		    	var winHeight =  window.screen.height;
				var winWidth = 	window.screen.width;
				if(winWidth == 1024){
			  	 	$('#taby').css('height',703+'px');
			  	 	$('#taby').find('iframe').css('height',674+'px');
				   }else if(winWidth == 1280){
			  	 	$('#taby').css('height',703+'px');
			  	 	$('#taby').find('iframe').css('height',674+'px');
				   }else if(winWidth == 1366){
				   	$('#taby').css('height',703+'px');
			  	 	$('#taby').find('iframe').css('height',674+'px');
				   }else if(winWidth == 1920){
			   		$('#taby').css('height',703+'px');
			  	 	$('#taby').find('iframe').css('height',674+'px');
				   }else{
			   		$('#taby').css('height',703+'px');
			  	 	$('#taby').find('iframe').css('height',674+'px');
				   }
		    })
    		</script>
    		
        
    		@endif

				
		@endif


		@if(auth::user()->role_id != 22)
		<div class="btn-toolbar list-toolbar">
			<div class="form-all mg_t30">
				<div id="tb">
					{{--@if(Auth::guard('admin')->user()->role_id != 22)
					<a class="easyui-linkbutton" iconCls="icon-add" onclick="add()" plain="true">新增</a>
					@endif--}}
					{{--<a class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="edit()">编辑</a>--}}
					{{--<a class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="cancel()">注销</a>
					<a class="easyui-linkbutton" iconCls="icon-print" plain="true" onclick="print()">打印</a>--}}
					<a class="easyui-linkbutton" iconCls="icon-large-smartart" plain="true" onclick="export_unit()">导出</a>

					{{--@if(Auth::guard('admin')->user()->role_id != 22)
					<a class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="add()">新增</a>
					@endif--}}
					{{--<a class="easyui-linkbutton" iconCls="icon-tip" plain="true" onclick="st()">重点级别设置</a>--}}
					{{--<a class="easyui-linkbutton" iconCls="icon-save" plain="true" onclick="jump1()">法人登记</a>}}
					{{--<a class="easyui-linkbutton" iconCls="icon-bw" plain="true" onclick="jump2()">保卫人员登记</a>}}
					{{--<a class="easyui-linkbutton" iconCls="icon-zd" plain="true" onclick="jump3()">重点岗位人员登记</a>}}
					{{--<a class="easyui-linkbutton" iconCls="icon-jg" plain="true" onclick="jump4()">保卫机构</a>--}}
					{{--<a class="easyui-linkbutton" iconCls="icon-zy" plain="true" onclick="jump5()">重要部位登记</a>}}

					{{--<a class="easyui-linkbutton" iconCls="icon-tip" plain="true" onclick="jq()">警情通报</a>}}

						{{--<a class="easyui-linkbutton" iconCls="icon-tip" plain="true" onclick="rysh()">人员审核</a>}}




				<!-- 	<a class="easyui-linkbutton" iconCls="icon-tip" plain="true" onclick="jq()">警情通报</div> -->


					{{--<a class="easyui-linkbutton" iconCls="icon-af" plain="true" onclick="jump6()">安防设施</a>--}}
					{{--<a class="easyui-linkbutton" iconCls="icon-yj" plain="true" onclick="jump7()">应急预案</a>--}}
					{{--<a class="easyui-linkbutton" iconCls="icon-jq" plain="true" onclick="jump8()">警情上报</a>--}}
					{{--<a class="easyui-linkbutton" iconCls="icon-aj" plain="true" onclick="jump9()">安全检查</a>--}}
					{{--<a class="easyui-linkbutton" iconCls="icon-zd" plain="true" onclick="jump10()">保卫制度</a>--}}
					{{--<a class="easyui-linkbutton" iconCls="icon-jl" plain="true" onclick="jump11()">历史变更记录</a>--}}
					{{--@if(Auth::guard('admin')->user()->role_id != 22)
						<a class="easyui-linkbutton" iconCls="icon-zd" plain="true" onclick="jump12()">发送信息</a>
					@else
						<a class="easyui-linkbutton" iconCls="icon-zd" plain="true" onclick="jump12()">查看信息</a>
					@endif--}}
					{{--@if(Auth::guard('admin')->user()->role_id == 15)
						<a class="easyui-linkbutton" iconCls="icon-bw" plain="true" onclick="jump13()">认领</a>
						<a class="easyui-linkbutton" iconCls="icon-bw" plain="true" onclick="jump14()">释放</a>
					@endif--}}
				</div>
				<table id="dg" title="单位列表" class="easyui-datagrid" style="width:100%;height:600px"
						data-options="rownumbers:true,singleSelect:true,pagination:true,pageSize:20,url:'{{url('admin/units/index')}}',method:'get',toolbar:'#tb'">
					<thead>
						<tr>
							<th data-options="field:'city'" width="5%" align="center">市</th>
							<th data-options="field:'area'" width="10%" align="center">区</th>
							<th data-options="field:'org_id'" width="10%" align="center">所属派出所</th>
							<th data-options="field:'is_imp'" width="7%" align="center">重点级别</th>
							<th data-options="field:'type'" width="10%" align="center">企业类型</th>
							<th data-options="field:'xingzhi'" width="8%" align="center">企业性质</th>
							<th data-options="field:'name'" width="15%" align="center">单位名</th>
							<th data-options="field:'address'" width="15%" align="center">详细地址</th>
							<th data-options="field:'frdb_name'" width="10%" align="center">联系人</th>
							<th data-options="field:'frdb_phone'" width="11%" align="center">联系电话</th>
							{{--<th data-options="field:'id',formatter:formatAction" width="10%" align="center">操作</th>--}}
						</tr>
					</thead>
				</table>
		  </div>
		</div>

	<!--新增-->
	<div id="w" class="easyui-window" closed="true" style="overflow: hidden;"></div>
		<style>
			.btns {
				padding-left: 20px;
				margin-bottom: 10px;
			}
			.mg_b20{
				margin-bottom: 20px;
			}
		</style>
		<div id="shili_tb1" class="easyui-window" closed="true">
			<h2 class="text-center mg_b20">各地区单位数量统计</h2>
			<div class="btns">
				<button class="btn btn-default btn-sm" id="bzt">饼状图</button>
				<button class="btn btn-default btn-sm" id="zzt">柱状图</button>
				<button class="btn btn-default btn-sm" id="zxt">折线图</button>
			</div>
			<div id="shul" style="height:470px;width:600px;margin: 0 auto;"></div>
		</div>

		<div id="shili_tb2" class="easyui-window" closed="true">
			<h2 class="text-center mg_b20">各重点级别单位数量统计</h2>
			<div class="btns">
				<button class="btn btn-default btn-sm" id="bzt2">饼状图</button>
				<button class="btn btn-default btn-sm" id="zzt2">柱状图</button>
				<button class="btn btn-default btn-sm" id="zxt2">折线图</button>
			</div>
			<div id="jbshul" style="height:470px;width:600px;margin: 0 auto;"></div>
		</div>

		<div id="shili_tb3" class="easyui-window" closed="true">
			<h2 class="text-center mg_b20">各行业类别单位数量统计</h2>
			<div class="btns">
				<button class="btn btn-default btn-sm" id="bzt3">饼状图</button>
				<button class="btn btn-default btn-sm" id="zzt3">柱状图</button>
				<button class="btn btn-default btn-sm" id="zxt3">折线图</button>
			</div>
			<div id="hylbul" style="height:570px;width:600px;margin: 0 auto;"></div>
		</div>

		<div id="shili_tb4" class="easyui-window" closed="true">
			<h2 class="text-center mg_b20">各状态单位数量统计</h2>
			<div class="btns">
				<button class="btn btn-default btn-sm" id="bzt4">饼状图</button>
				<button class="btn btn-default btn-sm" id="zzt4">柱状图</button>
				<button class="btn btn-default btn-sm" id="zxt4">折线图</button>
			</div>
			<div id="zdztshul" style="height:470px;width:600px;margin: 0 auto;"></div>
		</div>
		
		<div id="shili_tb5" class="easyui-window" closed="true">
			<h2 class="text-center mg_b20">各性质单位数量统计</h2>
			<div class="btns">
				<button class="btn btn-default btn-sm" id="bzt5">饼状图</button>
				<button class="btn btn-default btn-sm" id="zzt5">柱状图</button>
				<button class="btn btn-default btn-sm" id="zxt5">折线图</button>
			</div>
			<div id="dwxzshul" style="height:470px;width:600px;margin: 0 auto;"></div>
		</div>
		


	<!-- <div id="jwd" class="easyui-window" closed="true" title="新增" data-options="iconCls:'icon-save'" style="width:800px;height:600px;padding:10px;"> -->
		<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=hrVnXxLAGVr6QZ0rt9MaxU8bBkwKzyQC"></script>
	</div>
	<!--编辑-->
	<!--注销-->
	<div id="dlg" class="easyui-dialog" title="注销" closed="true" style="width:400px;height:200px;line-height:100px;text-align:center;font-size:16px;padding:10px">
		您确定要注销该单位？
	</div>
	<!--设为重点单位-->
	<div id="unit" class="easyui-dialog" data-options="closed:true,iconCls:'icon-save'" style="width:300px;height:150px;padding:10px;">
		<form id="unit_form" method="post">
			<table>
				<tr>
					<td width="60" align="right">级 别：&nbsp;&nbsp;&nbsp;&nbsp;</td>
					<td>
						<select class="easyui-combobox" name="is_imp" id="is_imp" style="width:200px;">
							<option value="0">取消重点</option>
							<option value="1">省级</option>
							<option value="2">市级</option>
							<option value="3">县级</option>
							<option value="4">乡级</option>
						</select>
					</td>
				</tr>
			</table>
		</form>
	</div>

	<div id="menu" class="easyui-menu" style="width:200px;">
		<div onclick="edit()" iconCls="icon-edit">编辑</div>
		<div onclick="cancel()" iconCls="icon-undo">注销</div>
		{{--<div onclick="st()" iconCls="icon-tip">设为重点单位</div>--}}
		<div onclick="jump1()" iconCls="icon-save">法人登记</div>
		<div iconCls="icon-bw" onclick="jump2()">保卫人员登记</div>
		<div iconCls="icon-zd" onclick="jump3()">重点岗位人员登记</div>
		{{--<div iconCls="icon-jg" onclick="jump4()">保卫机构</div>--}}
		<div iconCls="icon-zy" onclick="jump5()">重要部位登记</div>

		
		<div iconCls="icon-tip" onclick="jump5()">警情通报</div>

		{{--<div iconCls="icon-af" onclick="jump6()">安防设施</div>--}}
		{{--<div iconCls="icon-yj" onclick="jump7()">应急预案</div>--}}
		{{--<div iconCls="icon-jq" onclick="jump8()">警情上报</div>--}}
		{{--<div iconCls="icon-aj" onclick="jump9()">安全检查</div>--}}
		{{--<div iconCls="icon-zd" onclick="jump10()">保卫制度</div>--}}
		{{--<div iconCls="icon-jl" onclick="jump11()">历史变更记录</div>--}}
		{{--@if(Auth::guard('admin')->user()->role_id != 22)
			<div iconCls="icon-zd" onclick="jump12()">发送信息</div>
		@else
			<div iconCls="icon-zd" onclick="jump12()">查看信息</div>
		@endif--}}
	</div>
	@endif
<script type="text/javascript" src="{{ URL::asset('/') }}js/weizhi.js"></script>
	<script type="text/javascript">
		
		// function getjwd(){
		// 	$('#jwd').window({
		// 		title: "获取经纬度",
		// 		href: 'getjwd',
		// 		width:'700',
		// 		height:'500',
		// 		top:($(window).height() - 500) * 0.5,
		// 		left:($(window).width() - 700) * 0.5,
		// 		modal:true,
		// 		closed: false,
		// 	});
		// }
		/*function formatAction(value,row,index){
			return '<a href="'+'edit/'+value+'" target="_blank">编辑</a>';
		}*/
		/*window.onload = function(){
			doSearch();
		}*/

        $('.update').click(function(){
            var i=window.confirm("确认更新吗？");
            if(i==0){
                return false;
            }
        });
		//搜索
		function doSearch(){
			$('#dg').datagrid('load',{
				city: $("input[name='city']").val(),
				area: $("input[name='area']").val(),
				org_id: $("input[name='org_id']").val(),
				name: $("input[name='name']").val(),
				type: $("select[name='type']").val(),
				xingzhi: $("select[name='xingzhi']").val(),
				is_del:$("select[name='is_del']").val(),
				jibie:$("select[name='jibie']").val(),
			});
		}


		function load_city_data_from_menu($id){
			$('#dg').datagrid('load',{
				city: $id,
			});
			$("input[name='city']").val($id);
			$("input[name='area']").val('');
			$("input[name='org_id']").val('');
			$("input[name='map_id']").val($id);

			$("select[name='jibie']").val(''),
			$("select[name='type']").val(''),
			$("select[name='xingzhi']").val(''),
			$("select[name='is_del']").val(''),
			$("input[name='name']").val('');
		}

		function load_area_data_from_menu($id){
			$('#dg').datagrid('load',{
				area: $id,
			});
			$("input[name='city']").val('');
			$("input[name='area']").val($id);
			$("input[name='org_id']").val('');
			$("input[name='map_id']").val($id);

			$("select[name='jibie']").val(''),
			$("select[name='type']").val(''),
			$("select[name='xingzhi']").val(''),
			$("select[name='is_del']").val(''),
			$("input[name='name']").val('');
		}
		function load_org_data_from_menu($id){
			$('#dg').datagrid('load',{
				org_id: $id,
			});
			$("input[name='city']").val('');
			$("input[name='area']").val('');
			$("input[name='org_id']").val($id);
			$("input[name='map_id']").val($id);

			$("select[name='jibie']").val(''),
			$("select[name='type']").val(''),
			$("select[name='xingzhi']").val(''),
			$("select[name='is_del']").val(''),
			$("input[name='name']").val('');
		}
	</script>

	<script type="text/javascript">
		var shuz = fb1();
		function export_unit(){
			var city = $("input[name='city']").val();
			var	area = $("input[name='area']").val();
			var org_id = $("input[name='org_id']").val();
			var	name = $("input[name='name']").val();
			var	type = $("select[name='type']").val();
			var	xingzhi = $("select[name='xingzhi']").val();
			var	jibie = $("select[name='jibie']").val();
			var url = "{{url('admin/units/export_unit')}}";
			//window.location.href = url+'?&status='+status+'&major_id='+major_id+'&add_time='+add_time;
			window.location.href = url+'?&city='+city+'&area='+area+'&org_id='+org_id+'&name='+name+'&xingzhi='+xingzhi+'&type='+type+'&jibie='+jibie;
		}
		function print(){
			var row = $('#dg').datagrid('getSelected');
			if (row) {
				window.open("{{url('admin/units/print_unit')}}"+"/"+row.id);
			} else {
				$.messager.alert('提示','请选择要打印的企业！');
			}
		}
		function add(){
			$('#w').window({
				title: "新增",
				href: 'add',
				width:shuz[0],
				height:shuz[1],
				top:shuz[2],
				left:shuz[3],
				modal:true,
				closed: false,
				minimizable:false,
			});
		}
		function edit(){
			$('#w').html('');
			var row = $('#dg').datagrid('getSelected');
			if (row) {
				var url = 'edit/'+row.id;
				$('#w').window({
					title: "编辑",
					href: url,
					modal:true,
					width:shuz[0],
					height:shuz[1],
					top:shuz[2],
					left:shuz[3],
					closed: false,
					minimizable:false,
					maximized:true
				});
			} else {
				$.messager.alert('提示','请选中要编辑的行！');
			}
		}


			//警情通报
			function jq(){
				$('#w').html('');
				var row = $('#dg').datagrid('getSelected');
				if (row) {
				var url = '/admin/jq/police/'+row.id;
				$('#w').window({
					title: "警情回复",
					href: url,
					width:'900',
					height:'560',
					width:shuz[0],
					height:shuz[1],
					top:shuz[2],
					left:shuz[3],
					modal:true,
					closed: false,
					minimizable:false,
				});
			} else {
				$.messager.alert('提示','请选择要查看的企业！');
			}
		}


			//人员审核
			function rysh(){
				$('#w').html('');
				var row = $('#dg').datagrid('getSelected');
				if (row) {
				var url = '/admin/rysh/police/'+row.id;
				$('#w').window({
					title: "核查回复",
					href: url,
					width:shuz[0],
					height:shuz[1],
					top:shuz[2],
					left:shuz[3],
					modal:true,
					closed: false,
					minimizable:false,
				});
			} else {
				$.messager.alert('提示','请选择要查看的企业！');
			}

		}
		function cancel(){
			var row = $('#dg').datagrid('getSelected');
			if (row) {
				$('#dlg').dialog({
					title: "注销",
					closed: false,
					modal:true,
					buttons: [{
						text: '确定',
						iconCls: 'icon-ok',
						handler: zhuxiao
					}, {
						text: '取消',
						iconCls: 'icon-cancel',
						handler: function () {
							$('#dlg').dialog('close');
						}
					}]
				});
			} else {
				$.messager.alert('提示','请选中要编辑的行！');
			}
		}
		function zhuxiao(){
			$('#dlg').dialog('close');
			var row = $('#dg').datagrid('getSelected');
			var url = 'zhuxiao/'+row.id;
			$.ajax({
				type: 'get',
				url: url,
				success: function(data){
					if(data.status == 1){
						$.messager.alert('信息提示',data.msg,'info');
						$('#unit').dialog('close');
						var rowIndex = $('#dg').datagrid('getRowIndex', row);
						$('#dg').datagrid('deleteRow', rowIndex);
					}else{
						$.messager.alert('信息提示',data.msg,'info');
					}
				}
			});
		}
		function st(){
			var row = $('#dg').datagrid('getSelected');
			if (row) {
				$('#unit').dialog({
					title: "重点级别设置",
					closed: false,
					modal:true,
					buttons: [{
						text: '确定',
						iconCls: 'icon-ok',
						handler: zhongdian
					}, {
						text: '取消',
						iconCls: 'icon-cancel',
						handler: function () {
							$('#unit').dialog('close');
						}
					}]
				});
			} else {
				$.messager.alert('提示','请选中要编辑的行！');
			}
		}
		function zhongdian(){
			var row = $('#dg').datagrid('getSelected');
			var jibie = $("#is_imp").val();
			var url = 'swzd/'+row.id+'/'+jibie;
			$.ajax({
				type: 'get',
				url: url,
				success: function(data){
					if(data.status == 1){
						$.messager.alert('信息提示',data.msg,'info');
						$('#unit').dialog('close');
						$('.pagination-load').click();
					}else{
						$.messager.alert('信息提示',data.msg,'info');
					}
				}
			});
		}


		/*$("#dg").datagrid({
			onRowContextMenu: function (e, rowIndex, rowData) {
				e.preventDefault();
				$(this).datagrid("clearSelections");
				$(this).datagrid("selectRow", rowIndex);
				$('#menu').menu('show', {
					left: e.pageX,
					top: e.pageY
				});
				e.preventDefault();
			}
		});*/
		$("#dg").datagrid({
			onDblClickRow: function (index, row) {
				tab();
			}
		});
		function tab(){
			$('#w').html('');
			var row = $('#dg').datagrid('getSelected');
			if (row) {
				var shuz = fb1();
				var url = 'tab/'+row.id;
				$('#w').window({
					title: "编辑",
					href: url,
					modal:true,
					width:shuz[0],
					height:shuz[1],
					top:shuz[2],
					left:shuz[3],
					closed: false,
					minimizable:false,
				});
			} else {
				$.messager.alert('提示','请选中要编辑的行！');
			}
		}
	</script>

	<script src="{{ URL::asset('/') }}build/dist/echarts.js"></script>

	<script type="text/javascript">
		var daTa ;
		var shul = echarts.init(document.getElementById('shul'));
		dwshul();
		function dwshul(id){
            var name =$("input[name='name']").val();
            var type = $("select[name='type']").val();
            var xingzhi = $("select[name='xingzhi']").val();
            var is_del = $("select[name='is_del']").val();
            var jibie = $("select[name='jibie']").val();
			$.ajax({
				type:"POST",
				url:"{{url('admin/bigapi/getunit')}}",
				async:true,
				data: {'id':id,'name':name,'type':type,'xingzhi':xingzhi,'is_del':is_del,'jibie':jibie,'_token':'{{csrf_token()}}'},
				dateType: 'json',
				success : function(data){
					var obj = {};
					var obj = jQuery.parseJSON(data);
					//    tubiao1(obj.city);  //饼图
					daTa = obj.city;
					console.log(obj.city)

				}

			});
		}
		setTimeout(function(){
			tubiao1(daTa);
		},500)

		$("#tjt").click(function(){
			var id = $("input[name='map_id']").val();
			dwshul(id)    //统计图数据
			console.log(id);
			$('#shili_tb1').window({
				title: "统计图",
				width:'900',
				height:'600',
				top:($(window).height() - 600) * 0.5,
				left:($(window).width() - 900) * 0.5,
				modal: true,
				closed: false,
				minimizable:false
			});
			shul.clear();
			setTimeout(function(){
				tubiao1(daTa);
			},200)
		})
		$("#bzt").click(function(){
			shul.clear();
			setTimeout(function(){
				tubiao1(daTa);
			},500)

		})
		$("#zzt").click(function(){
			shul.clear();
			setTimeout(function(){
				tubiao2(daTa);
			},500)

		})
		$("#zxt").click(function(){
			shul.clear();
			setTimeout(function(){
				tubiao3(daTa);
			},500)

		})

		function tubiao1(datas){
			shul_option = {
				backgroundColor: '',
				title: {
					left: 'center',
					top: 20,
					textStyle: {
						color: '#ccc'
					}
				},
				tooltip : {
					trigger: 'item',
					formatter: "{a} <br/>{b} : {c} ({d}%)"
				},
				series : [
					{
						name:'单位数量',
						type:'pie',
						radius : '55%',
						center: ['50%', '50%'],
						data:datas,
						roseType: 'radius',
						label: {
							normal: {
								textStyle: {
									color: '#000'
								}
							}
						},
						labelLine: {
							normal: {
								lineStyle: {
									color: '#000'
								},
								smooth: 0.2,
								length: 10,
								length2: 20
							}
						},
						color: ['#1b56ea','#f24949', '#4ddade'],
						itemStyle: {
							normal: {
								color: '',
								shadowBlur: 200,
								shadowColor: 'rgba(0, 0, 0, 0.5)'
							}
						},
						animationType: 'scale',
						animationEasing: 'elasticOut',
						animationDelay: function (idx) {
							return Math.random() * 200;
						}
					}
				]
			}

// 使用刚指定的配置项和数据显示图表。
			shul.setOption(shul_option);
		}

		function tubiao2_jian(data){
			var data1 = [];
			for(var i = 0 ;i<data.length;i++){
				data1.push(data[i].name);
			}
			return data1;
		}
		function tubiao2_jian1(data){
			var data2 = [];
			for(var i = 0 ;i<data.length;i++){
				data2.push(data[i].value);
			}
			return data2;
		}

		function tubiao2(datas){
			shul_option = {
				color: ['#3398DB'],
				tooltip : {
					trigger: 'axis',
					axisPointer : {            // 坐标轴指示器，坐标轴触发有效
						type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
					}
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
					{
						type : 'category',
						data : tubiao2_jian(datas),
						axisTick: {
							alignWithLabel: true
						}
					}
				],
				yAxis : [
					{
						type : 'value'
					}
				],
				series : [
					{
						name:'单位数量',
						type:'bar',
						barWidth: '20%',
						data:tubiao2_jian1(datas)
					}
				]
			};
// 使用刚指定的配置项和数据显示图表。
			shul.setOption(shul_option);
		}

		function tubiao3_jian(data){
			var data1 = [];
			for(var i = 0;i<data.length;i++){
				data1.push(data[i].name);
			}
			return data1;
		}
		function tubiao3_jian1(data){
			var data2 = [];
			for(var i = 0;i<data.length;i++){
				data2.push(data[i].value);
			}
			return data2;
		}
		function tubiao3(data){
			shul_option = {

				tooltip : {
					trigger: 'axis',
					axisPointer: {
						type: 'cross',
						label: {
							backgroundColor: 'transparent'
						}
					}
				},
				legend: {
					data:['单位数量'],
					textStyle:{    //图例文字的样式
						color:'#fff',
					}
				},
				toolbox: {
					show:false,
					feature: {
						saveAsImage: {}
					}
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
					{
						type : 'value',
						boundaryGap : false,
						axisLabel: {
							show: true,
							textStyle: {
								color: '#000'
							}
						}
					}
				],
				yAxis : [
					{
						type : 'category',
						data : tubiao3_jian(data),
						axisLabel: {
							show: true,
							textStyle: {
								color: '#000'
							}
						}
					}
				],
				series : [
					{
						name:'单位数量',
						type:'line',
						stack: '总量',
						areaStyle: {normal: {}},
						data:tubiao3_jian1(data)
					},
				]
			};
// 使用刚指定的配置项和数据显示图表。
			shul.setOption(shul_option);
		}
	</script>




	{{--按地区统计--}}
	<script type="text/javascript">
		var daTa2 ;
		// 单位级别数量统计
		var jbshul = echarts.init(document.getElementById('jbshul'));
		jbshul_fn();
		function jbshul_fn(id){
            var name =$("input[name='name']").val();
            var type = $("select[name='type']").val();
            var xingzhi = $("select[name='xingzhi']").val();
            var is_del = $("select[name='is_del']").val();
            var jibie = $("select[name='jibie']").val();
			$.ajax({
				type:"POST",
				url:"{{url('admin/bigapi/getdwjib')}}",
				async:true,
                data: {'id':id,'name':name,'type':type,'xingzhi':xingzhi,'is_del':is_del,'jibie':jibie,'_token':'{{csrf_token()}}'},
				dateType: 'json',
				success : function(data){
					var obj = {};
					var obj = jQuery.parseJSON(data);
					/*if(obj.city[0].length == 0){
					 jbshul.clear();
					 }else{
					 tubiao2(obj.city[0]);
					 }*/
					daTa2 = obj.city[0];
					console.log(obj.city[0]);
				}

			});
		}

		setTimeout(function(){
			tubiao2_2(daTa2);
		},500)

		$("#tjt2").click(function(){
			var id = $("input[name='map_id']").val();
			jbshul_fn(id) ;   //统计图数据
			console.log(id);
			$('#shili_tb2').window({
				title: "统计图",
				width:'900',
				height:'600',
				top:($(window).height() - 600) * 0.5,
				left:($(window).width() - 900) * 0.5,
				modal: true,
				closed: false,
				minimizable:false
			});
			jbshul.clear();
			setTimeout(function(){
				tubiao2_2(daTa2);
			},200)
		})

		$("#bzt2").click(function(){
			jbshul.clear();
			setTimeout(function(){
				tubiao1_2(daTa2);
			},500)

		})

		$("#zzt2").click(function(){
			jbshul.clear();
			setTimeout(function(){
				tubiao2_2(daTa2);
			},500)

		})
		$("#zxt2").click(function(){
			jbshul.clear();
			setTimeout(function(){
				tubiao3_2(daTa2);
			},500)

		})
		function tubiao1_2_jian(data){
			var data1 = [];
			for(x in data){
				data1.push({"name":x,"value":data[x]});
			}
			return data1;
		}
		function tubiao1_2(datas){

			jbshul_option = {
				backgroundColor: '',
				title: {
					left: 'center',
					top: 20,
					textStyle: {
						color: '#ccc'
					}
				},
				tooltip : {
					trigger: 'item',
					formatter: "{a} <br/>{b} : {c} ({d}%)"
				},
				series : [
					{
						name:'单位数量',
						type:'pie',
						radius : '55%',
						center: ['50%', '50%'],
						data:tubiao1_2_jian(datas),
						roseType: 'radius',
						label: {
							normal: {
								textStyle: {
									color: '#000'
								}
							}
						},
						labelLine: {
							normal: {
								lineStyle: {
									color: '#000'
								},
								smooth: 0.2,
								length: 10,
								length2: 20
							}
						},
						color: ['#1b56ea','#f24949', '#4ddade'],
						itemStyle: {
							normal: {
								color: '',
								shadowBlur: 200,
								shadowColor: 'rgba(0, 0, 0, 0.5)'
							}
						},

						animationType: 'scale',
						animationEasing: 'elasticOut',
						animationDelay: function (idx) {
							return Math.random() * 200;
						}
					}
				]
			}

// 使用刚指定的配置项和数据显示图表。
			jbshul.setOption(jbshul_option);
		}


		function tubiao2_2_jian(data){
			var data1 = [];
			for(x in data){
				data1.push(x);
			}
			return data1;
		}
		function tubiao2_2_jian1(data){
			var data2 = [];
			for(x in data){
				data2.push(data[x]);
			}
			return data2;
		}
		function tubiao2_2(data){
			jbshul_option = {
				color: ['#3398DB'],
				tooltip : {
					trigger: 'axis',
					axisPointer : {            // 坐标轴指示器，坐标轴触发有效
						type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
					}
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
					{
						type : 'category',
						data : tubiao2_2_jian(data),
						axisTick: {
							alignWithLabel: true
						},
						axisLabel: {
							show: true,
							textStyle: {
								color: '#000'
							}
						}
					}
				],
				yAxis : [
					{
						type : 'value',
						axisLabel: {
							show: true,
							textStyle: {
								color: '#000'
							}
						}
					}
				],
				series : [
					{
						name:'单位数量',
						type:'bar',
						barWidth: '60%',
						data:tubiao2_2_jian1(data)

					}
				]
			};
// 使用刚指定的配置项和数据显示图表。
			jbshul.setOption(jbshul_option);
		}

		function tubiao3_2_jian(data){
			var data1 = [];
			for(x in data){
				data1.push(x);
			}
			return data1;
		}

		function tubiao3_2_jian1(data){
			var data2 = [];
			for(x in data){
				data2.push(data[x]);
			}
			return data2;
		}
		function tubiao3_2(data){
			jbshul_option = {

				tooltip : {
					trigger: 'axis',
					axisPointer: {
						type: 'cross',
						label: {
							backgroundColor: 'transparent'
						}
					}
				},
				legend: {
					data:['单位数量'],
					textStyle:{    //图例文字的样式
						color:'#fff',
					}
				},
				toolbox: {
					show:false,
					feature: {
						saveAsImage: {}
					}
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
					{
						type : 'value',
						boundaryGap : false,
						axisLabel: {
							show: true,
							textStyle: {
								color: '#000'
							}
						}
					}
				],
				yAxis : [
					{
						type : 'category',
						data : tubiao3_2_jian(data),
						axisLabel: {
							show: true,
							textStyle: {
								color: '#000'
							}
						}
					}
				],
				series : [
					{
						name:'单位数量',
						type:'line',
						stack: '总量',
						areaStyle: {normal: {}},
						data:tubiao3_2_jian1(data)
					},



				]
			};

// 使用刚指定的配置项和数据显示图表。
			jbshul.setOption(jbshul_option);
		}
	</script>

	{{--按类型统计--}}
	<script type="text/javascript">
		var daTa3 ;
		//行业类别数量统计
		var hylbul = echarts.init(document.getElementById('hylbul'));
		hylbul_fn();
		function hylbul_fn(id){
            var name =$("input[name='name']").val();
            var type = $("select[name='type']").val();
            var xingzhi = $("select[name='xingzhi']").val();
            var is_del = $("select[name='is_del']").val();
            var jibie = $("select[name='jibie']").val();
			$.ajax({
				type:"POST",
				url:"{{url('admin/bigapi/gethylb')}}",
				async:true,
                data: {'id':id,'name':name,'type':type,'xingzhi':xingzhi,'is_del':is_del,'jibie':jibie,'_token':'{{csrf_token()}}'},
				dateType: 'json',
				success : function(data){
					var obj = {};
					var obj = jQuery.parseJSON(data);
					/* tubiao8(obj.city[0])
					 if(obj.city[0].length == 0){
					 hylbul.clear();
					 }else{
					 tubiao8(obj.city[0])
					 }*/
					daTa3 = obj.city[0];
				}

			});
		}
		setTimeout(function(){
			tubiao2_3(daTa3);
		},500)

		$("#tjt3").click(function(){
			var id = $("input[name='map_id']").val();
			hylbul_fn(id);    //统计图数据
			console.log(id);
			$('#shili_tb3').window({
				title: "统计图",
				width:'900',
				height:'600',
				top:($(window).height() - 600) * 0.5,
				left:($(window).width() - 900) * 0.5,
				modal: true,
				closed: false,
				minimizable:false
			});
			hylbul.clear();
			setTimeout(function(){
				tubiao2_3(daTa3);
			},200)
		})

		$("#bzt3").click(function(){
			hylbul.clear();
			setTimeout(function(){
				tubiao1_3(daTa3);
			},500)

		})

		$("#zzt3").click(function(){
			hylbul.clear();
			setTimeout(function(){
				tubiao2_3(daTa3);
			},500)

		})
		$("#zxt3").click(function(){
			hylbul.clear();
			setTimeout(function(){
				tubiao3_3(daTa3);
			},500)

		})

		function tubiao1_3_jian(data){
			var data1 = [];
			for(x in data){
				data1.push({"name":x,"value":data[x]});
			}
			return data1;
		}
		function tubiao1_3(data){
			hylbul_option = {
				tooltip : {
					trigger: 'item',
					formatter: "{a} <br/>{b} : {c} ({d}%)"
				},
				legend: {
					orient: 'vertical',
					left: 'left',
					data: ['实有','注销','合并'],
					textStyle:{    //图例文字的样式
						color:'#000',
					}
				},
				series : [
					{
						name: '单位数量',
						type: 'pie',
						radius : '55%',
						center: ['50%', '60%'],
						data:tubiao1_3_jian(data),
						itemStyle: {
							emphasis: {
								shadowBlur: 10,
								shadowOffsetX: 0,
								shadowColor: 'rgba(0, 0, 0, 0.5)'
							}
						}
					}
				]
			};

// 使用刚指定的配置项和数据显示图表。
			hylbul.setOption(hylbul_option);
		}

		function tubiao2_3_jian(data){
			var data1 = [];
			for(x in data){
				data1.push(x);
			}
			return data1;
		}
		function tubiao2_3_jian1(data){
			var data2 = [];
			for(x in data){
				data2.push(data[x]);
			}
			return data2;
		}

		function tubiao2_3(datas){
			hylbul_option = {
				color: ['#3398DB'],
				tooltip : {
					trigger: 'axis',
					axisPointer : {            // 坐标轴指示器，坐标轴触发有效
						type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
					}
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '30%',
					containLabel: true,
				},
				xAxis : [
					{
						type : 'category',
						data : tubiao2_3_jian(datas),
						axisTick: {
							alignWithLabel: true
						},
						axisLabel:{
							interval:0,//横轴信息全部显示
							rotate:-90,//-30度角倾斜显示
						}
					}
				],
				yAxis : [
					{
						type : 'value'
					}
				],
				series : [
					{
						name:'单位数量',
						type:'bar',
						barWidth: '20%',
						data:tubiao2_3_jian1(datas)
					}
				]
			};
// 使用刚指定的配置项和数据显示图表。
			hylbul.setOption(hylbul_option);
		}

		function tubiao3_3_jian(data){
			var data1 = [];
			for(x in data){
				data1.push(x);
			}
			return data1;
		}
		function tubiao3_3_jian1(data){
			var data2 = [];
			for(x in data){
				data2.push(data[x]);
			}
			return data2;
		}

		function tubiao3_3(data){
			hylbul_option = {

				tooltip : {
					trigger: 'axis',
					axisPointer: {
						type: 'cross',
						label: {
							backgroundColor: 'transparent'
						}
					}
				},
				legend: {
					data:['单位数量'],
					textStyle:{    //图例文字的样式
						color:'#000',
					}
				},
				toolbox: {
					show:false,
					feature: {
						saveAsImage: {}
					}
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
					{
						type : 'value',
						boundaryGap : false,
						axisLabel: {
							show: true,
							textStyle: {
								color: '#000'
							}
						}
					}
				],
				yAxis : [
					{
						type : 'category',
						data : tubiao3_3_jian(data),
						axisLabel: {
							show: true,
							textStyle: {
								color: '#000'
							}
						},
						axisLabel:{
							interval:0,//横轴信息全部显示
							rotate:0,//-30度角倾斜显示
						}
					}
				],
				series : [
					{
						name:'单位数量',
						type:'line',
						stack: '总量',
						areaStyle: {normal: {}},
						data:tubiao3_3_jian1(data)
					},



				]
			};

// 使用刚指定的配置项和数据显示图表。
			hylbul.setOption(hylbul_option);
		}
	</script>

	{{--按类别统计--}}
	<script type="text/javascript">
		var daTa4 ;
		//单位状态数量统计
		var zdztshul = echarts.init(document.getElementById('zdztshul'));
		zdztshul_fn();
		function zdztshul_fn(id){
            var name =$("input[name='name']").val();
            var type = $("select[name='type']").val();
            var xingzhi = $("select[name='xingzhi']").val();
            var is_del = $("select[name='is_del']").val();
            var jibie = $("select[name='jibie']").val();
			$.ajax({
				type:"POST",
				url:"{{url('admin/bigapi/getdwzt')}}",
				async:true,
                data: {'id':id,'name':name,'type':type,'xingzhi':xingzhi,'is_del':is_del,'jibie':jibie,'_token':'{{csrf_token()}}'},
				dateType: 'json',
				success : function(data){
					var obj = {};
					var obj = jQuery.parseJSON(data);
					console.log(obj.city)
					/*  if(obj.city[0].length == 0){
					 zdztshul.clear();
					 }else{
					 tubiao7(obj.city[0])
					 }*/
					daTa4 = obj.city[0];
				}

			});
		}
		

		$("#tjt4").click(function(){
			var id = $("input[name='map_id']").val();
			zdztshul_fn(id) ;   //统计图数据
			console.log(id);
			$('#shili_tb4').window({
				title: "编辑",
				width:'900',
				height:'600',
				top:($(window).height() - 600) * 0.5,
				left:($(window).width() - 900) * 0.5,
				modal: true,
				closed: false,
				minimizable:false
			});
			zdztshul.clear();
			setTimeout(function(){
				tubiao1_4(daTa4);
			},500)
		})

		$("#bzt4").click(function(){
			zdztshul.clear();
			setTimeout(function(){
				tubiao1_4(daTa4);
			},500)

		})

		$("#zzt4").click(function(){
			zdztshul.clear();
			setTimeout(function(){
				tubiao2_4(daTa4);
			},500)

		})
		$("#zxt4").click(function(){
			zdztshul.clear();
			setTimeout(function(){
				tubiao3_4(daTa4);
			},500)

		})


		function tubiao1_4_jian(data){
			var data1 = [];
			for(x in data){
				data1.push({"name":x,"value":data[x]});
			}
			return data1;
		}
		function tubiao1_4(data){
			zdztshul_option = {
				tooltip : {
					trigger: 'item',
					formatter: "{a} <br/>{b} : {c} ({d}%)"
				},
				legend: {
					orient: 'vertical',
					left: 'left',
					data: ['实有','注销','合并'],
					textStyle:{    //图例文字的样式
						color:'#000',
					}
				},
				series : [
					{
						name: '单位数量',
						type: 'pie',
						radius : '55%',
						center: ['50%', '60%'],
						data:tubiao1_4_jian(data),
						itemStyle: {
							emphasis: {
								shadowBlur: 10,
								shadowOffsetX: 0,
								shadowColor: 'rgba(0, 0, 0, 0.5)'
							}
						}
					}
				]
			};

// 使用刚指定的配置项和数据显示图表。
			zdztshul.setOption(zdztshul_option);
		}

		function tubiao2_4_jian(data){
			var data1 = [];
			for(x in data){
				data1.push(x);
			}
			return data1;
		}
		function tubiao2_4_jian1(data){
			var data2 = [];
			for(x in data){
				data2.push(data[x]);
			}
			return data2;
		}

		function tubiao2_4(datas){
			zdztshul_option = {
				color: ['#3398DB'],
				tooltip : {
					trigger: 'axis',
					axisPointer : {            // 坐标轴指示器，坐标轴触发有效
						type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
					}
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
					{
						type : 'category',
						data : tubiao2_4_jian(datas),
						axisTick: {
							alignWithLabel: true
						}
					}
				],
				yAxis : [
					{
						type : 'value'
					}
				],
				series : [
					{
						name:'单位数量',
						type:'bar',
						barWidth: '20%',
						data:tubiao2_4_jian1(datas)
					}
				]
			};
// 使用刚指定的配置项和数据显示图表。
			zdztshul.setOption(zdztshul_option);
		}

		function tubiao3_4_jian(data){
			var data1 = [];
			for(x in data){
				data1.push(x);
			}
			return data1;
		}
		function tubiao3_4_jian1(data){
			var data2 = [];
			for(x in data){
				data2.push(data[x]);
			}
			return data2;
		}

		function tubiao3_4(data){
			zdztshul_option = {

				tooltip : {
					trigger: 'axis',
					axisPointer: {
						type: 'cross',
						label: {
							backgroundColor: 'transparent'
						}
					}
				},
				legend: {
					data:['单位数量'],
					textStyle:{    //图例文字的样式
						color:'#fff',
					}
				},
				toolbox: {
					show:false,
					feature: {
						saveAsImage: {}
					}
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
					{
						type : 'value',
						boundaryGap : false,
						axisLabel: {
							show: true,
							textStyle: {
								color: '#000'
							}
						}
					}
				],
				yAxis : [
					{
						type : 'category',
						data : tubiao3_4_jian(data),
						axisLabel: {
							show: true,
							textStyle: {
								color: '#000'
							}
						}
					}
				],
				series : [
					{
						name:'单位数量',
						type:'line',
						stack: '总量',
						areaStyle: {normal: {}},
						data:tubiao3_4_jian1(data)
					},



				]
			};

// 使用刚指定的配置项和数据显示图表。
			zdztshul.setOption(zdztshul_option);
		}
	</script>
	<!--按性质统计-->
	<script type="text/javascript">
		var daTa5 ;
		//单位状态数量统计
		var dwxzshul = echarts.init(document.getElementById('dwxzshul'));
		dwztshul_fn();
		function dwztshul_fn(id){
            var name =$("input[name='name']").val();
            var type = $("select[name='type']").val();
            var xingzhi = $("select[name='xingzhi']").val();
            var is_del = $("select[name='is_del']").val();
            var jibie = $("select[name='jibie']").val();
			$.ajax({
				type:"POST",
				url:"{{url('admin/bigapi/getxingzhi')}}",
				async:true,
                data: {'id':id,'name':name,'type':type,'xingzhi':xingzhi,'is_del':is_del,'jibie':jibie,'_token':'{{csrf_token()}}'},
				dateType: 'json',
				success : function(data){
					var obj = {};
					var obj = jQuery.parseJSON(data);
					console.log('55555')
					console.log(obj.city)
					/*  if(obj.city[0].length == 0){
					 zdztshul.clear();
					 }else{
					 tubiao7(obj.city[0])
					 }*/
					daTa5 = obj.city[0];
				}

			});
		}
		

		$("#tjt5").click(function(){
			var id = $("input[name='map_id']").val();
			dwztshul_fn(id) ;   //统计图数据
			console.log(id);
			$('#shili_tb5').window({
				title: "编辑",
				width:'900',
				height:'600',
				top:($(window).height() - 600) * 0.5,
				left:($(window).width() - 900) * 0.5,
				modal: true,
				closed: false,
				minimizable:false
			});
			dwxzshul.clear();
			setTimeout(function(){
				tubiao1_5(daTa5);
			},500)
		})

		$("#bzt5").click(function(){
			dwxzshul.clear();
			setTimeout(function(){
				tubiao1_5(daTa5);
			},500)

		})

		$("#zzt5").click(function(){
			dwxzshul.clear();
			setTimeout(function(){
				tubiao2_5(daTa5);
			},500)

		})
		$("#zxt5").click(function(){
			dwxzshul.clear();
			setTimeout(function(){
				tubiao3_5(daTa5);
			},500)

		})


		function tubiao1_5_jian(data){
			var data1 = [];
			for(x in data){
				data1.push({"name":x,"value":data[x]});
			}
			return data1;
		}
		function tubiao1_5(data){
			dwxzshul_option = {
				tooltip : {
					trigger: 'item',
					formatter: "{a} <br/>{b} : {c} ({d}%)"
				},
				legend: {
					orient: 'vertical',
					left: 'left',
//					data: ['实有','注销','合并'],
					textStyle:{    //图例文字的样式
						color:'#000',
					}
				},
				series : [
					{
						name: '单位数量',
						type: 'pie',
						radius : '55%',
						center: ['50%', '60%'],
						data:tubiao1_5_jian(data),
						itemStyle: {
							emphasis: {
								shadowBlur: 10,
								shadowOffsetX: 0,
								shadowColor: 'rgba(0, 0, 0, 0.5)'
							}
						}
					}
				]
			};

// 使用刚指定的配置项和数据显示图表。
			dwxzshul.setOption(dwxzshul_option);
		}

		function tubiao2_5_jian(data){
			var data1 = [];
			for(x in data){
				data1.push(x);
			}
			return data1;
		}
		function tubiao2_5_jian1(data){
			var data2 = [];
			for(x in data){
				data2.push(data[x]);
			}
			return data2;
		}

		function tubiao2_5(datas){
			dwxzshul_option = {
				color: ['#3398DB'],
				tooltip : {
					trigger: 'axis',
					axisPointer : {            // 坐标轴指示器，坐标轴触发有效
						type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
					}
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
					{
						type : 'category',
						data : tubiao2_5_jian(datas),
						axisTick: {
							alignWithLabel: true
						}
					}
				],
				yAxis : [
					{
						type : 'value'
					}
				],
				series : [
					{
						name:'单位数量',
						type:'bar',
						barWidth: '20%',
						data:tubiao2_5_jian1(datas)
					}
				]
			};
// 使用刚指定的配置项和数据显示图表。
			dwxzshul.setOption(dwxzshul_option);
		}

		function tubiao3_5_jian(data){
			var data1 = [];
			for(x in data){
				data1.push(x);
			}
			return data1;
		}
		function tubiao3_5_jian1(data){
			var data2 = [];
			for(x in data){
				data2.push(data[x]);
			}
			return data2;
		}

		function tubiao3_5(data){
			dwxzshul_option = {

				tooltip : {
					trigger: 'axis',
					axisPointer: {
						type: 'cross',
						label: {
							backgroundColor: 'transparent'
						}
					}
				},
				legend: {
					data:['单位数量'],
					textStyle:{    //图例文字的样式
						color:'#fff',
					}
				},
				toolbox: {
					show:false,
					feature: {
						saveAsImage: {}
					}
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis : [
					{
						type : 'value',
						boundaryGap : false,
						axisLabel: {
							show: true,
							textStyle: {
								color: '#000'
							}
						}
					}
				],
				yAxis : [
					{
						type : 'category',
						data : tubiao3_5_jian(data),
						axisLabel: {
							show: true,
							textStyle: {
								color: '#000'
							}
						}
					}
				],
				series : [
					{
						name:'单位数量',
						type:'line',
						stack: '总量',
						areaStyle: {normal: {}},
						data:tubiao3_5_jian1(data)
					},



				]
			};

// 使用刚指定的配置项和数据显示图表。
			dwxzshul.setOption(dwxzshul_option);
		}
	</script>
@stop
